{include file=header.html}
<script language="javascript" type="text/javascript" src="{res file=js/jquery-1.2.6.js}"></script>
<script language="javascript" type="text/javascript" src="{lib file=jquery.plugins/jquery.validate.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=js/common.js}"></script>
<script language="javascript" type="text/javascript" src="{lib file=ajaxfileupload.js}"></script>
<script language="javascript" type="text/javascript" src="{res file=js/jquery.funkyUI.js}"></script>
<style>
label.error {margin-left:2em; color:#FF0000;}
.tab-frame{width:900px;}
</style>
<script type="text/javascript">
$(function(){
	$('#main_form').validate({
        onkeyup : false,
		onfocusout : false,
		rules : {
			main_code: {
				required: true,
			},
			brand_id: {
				required: true,
			}
		},
		messages : {
			main_code: {
				required: '{$lang.main_code_empty}',
			},
			brand_id: {
				required: '{$lang.brand_select_pls}'
			}
		}
	 });
});
</script>
<body>
<div class="sub-body">
<div class="tab-frame">
<div class="tab-title-1">
<!--{if $smarty.get.act eq 'add'}--><span>{$lang.add_new_main}</span><!--{else}--><span>{$lang.edit_main}</span><!--{/if}-->
</div>
<form action="" method="post" id="main_form">
<table width="100%" cellspacing="0" cellpadding="0" class="tab-display">
	<tr>
		<th width="100" align="right">{$lang.main_code}：</th>
		<td align="left"><input type="text" name="main_code" id="main_code" value="{$main.main_code}" class="input-1" /></td>
	</tr>
    <tr>
		<th width="100" align="right">{$lang.genus_brand}：</th>
		<td align="left"><select name="brand_id" id="brand_id">
        <option value=""></option>
        {foreach from=$brand_list item=brands}
		  <option {if $brands.brand_id eq $main.brand_id}selected{/if} value="{$brands.brand_id}">{$brands.brand_name}&nbsp;&nbsp;({$brands.company_name|escape})</option>
         {/foreach}
		</select></td>
	</tr>
	<tr>
		<th width="100" align="right">{$lang.main_image}：</th>
		<td align="left">
			<input type="button" class="btn-3" value="{$lang.upload_enclosure}" onClick="upload_docs({$belongs_main_label}, {$main.m_id|default:$default_cust_id});" />
			<div id="main_label_file">
                <!--{foreach from=$main_file item=file}-->
                <span><a href="download.php?id={$file.file_id}" ><img src="{$file.file_path}" title="{$file.file_name}" width="250px" height="60px"></img></a>
                <a class="pic_del" href="{url app=comupload&act=delete&id=$file.file_id}" onClick="return confirm('{$lang.confirm_del_file}')" title="{$lang.delete}">&nbsp;</a>
                </span>
				<!--{if !$smarty.foreach.last}--><!--{/if}--><!--{/foreach}-->
            </div>
		</td>
	</tr>
	<tr>
		<td colspan="2" align="center"><input type="submit" value="{$lang.submit}" class="btn-2"/></td>
	</tr>
</table>
</form>
<script language="javascript" type="text/javascript" src="{res file=js/tab_color.js}"></script>
</div>
</div>
</body>
</html>